<?php
namespace app\common\validate;

use think\Validate;

class CartValidate extends Validate{

    protected $rule = [
        'user_id'=>'require|number',    //名称可以相同 因为有分组
        'product_id'=>'require|number',
        'num'=>'require|number'
    ];

    protected $message = [
        'user_id.require'=>'没有登录',
        'product_id.require'=>'没有选择产品',
        'product_id.number'=>'没有选择产品',
        'num.require'=>'没有选择数量',
    ];

    protected $scene = [
        'add' => ['user_id','product_id','num'],
        'edit'=> ['user_id','product_id','num'],
    ];
}